var moment = require('moment');
var _ = require('underscore');

module.exports = function (app) {
  app.get('/mobile/user/:userId/app/:appId/alarmRealTime.json', function(req, res) {
    var data = [
      {
        "appId": 111,
        "alarmName": "APP报警项-综合",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 3215,//全局吞吐量
        "alarmStatus": 3, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":1,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 500 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2000 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.2
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 3,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 4,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项-WARNING",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 1310,//全局吞吐量
        "alarmStatus": 2, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 600 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2200 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项-Double",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 1160,//全局吞吐量
        "alarmStatus": 3, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 700 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2400 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.4
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1.5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项-台风",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 910,//全局吞吐量
        "alarmStatus": 1, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":1,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 500 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2000 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.2
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 3,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 4,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项2048",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 4101,//全局吞吐量
        "alarmStatus": 2, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 600 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2200 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项-吞吐量",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 160,//全局吞吐量
        "alarmStatus": 3, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 700 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2400 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.4
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1.5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项-APP整体",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 310,//全局吞吐量
        "alarmStatus": 3, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 600 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2200 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项-频率",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 610,//全局吞吐量
        "alarmStatus": 3, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 500 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2000 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.2
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 3,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 4,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项666666",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 610,//全局吞吐量
        "alarmStatus": 2, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 500 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 2000 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.2
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 3,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 4,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 3
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      },

      {
        "appId": 111,
        "alarmName": "APP报警项4",
        "alarmType": 1,//监控项 1、APP整体
        "cpm": 1231,//全局吞吐量
        "alarmStatus": 4, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId":123,
        "createUserName":"OneAPM",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 800 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 3200 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 0.9
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 1.9 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 3,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 4.5
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 2,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 6.5 //阈值 单位：毫秒 或 百分百
              }
            ]
          }
        ]
      }
    ];

    var list = _.chain(data);
    var value = parseInt(req.query.alarmStatus);
    if (value) {
      list = list.filter(function (item) {
        return item.alarmStatus === value;
      });
    }

    if (req.query.alarmName !== undefined) {
      list = list.filter(function (item) {
        return item.alarmName.toLowerCase().indexOf(req.query.alarmName.toLowerCase()) !== -1;
      });
    }

    res.status(200).json(list.value());
  });

  // http错误率：classify=app statusCode=400
  // https://mi.oneapm.com/mobile/user/4077/app/684/errorrate.json?order=2&spanTime=1296000000&size=30&classify=app&offset=0&limit=5&endTime=&statusCode=400&_=1457001094444
  //
  // 网络错误率：classify=app errorCode=0
  // https://mi.oneapm.com/mobile/user/4077/app/684/errorrate.json?order=2&spanTime=1296000000&size=30&classify=app&offset=0&limit=5&endTime=&errorCode=0&_=1457001094445
  app.get('/mobile/user/:userId/app/:appId/errorrate.json', function(req, res) {
    if (req.query.classify === 'app' && req.query.statusCode !== undefined) {
      res.status(200).json(
        {
          "result": [{
            "combData": {
              "count": 7.2485566E7,
              "et": 1458640800000,
              "st": 1457366400000,
              "val": 5614
            },
            "data": [{
              "count": 4083428,
              "et": 1457452800000,
              "st": 1457366400000,
              "val": 229
            }, {
              "count": 4031859,
              "et": 1457539200000,
              "st": 1457452800000,
              "val": 239
            }, {
              "count": 4170228,
              "et": 1457625600000,
              "st": 1457539200000,
              "val": 295
            }, {
              "count": 5839928,
              "et": 1457712000000,
              "st": 1457625600000,
              "val": 371
            }, {
              "count": 5156565,
              "et": 1457798400000,
              "st": 1457712000000,
              "val": 341
            }, {
              "count": 5087240,
              "et": 1457884800000,
              "st": 1457798400000,
              "val": 268
            }, {
              "count": 5451586,
              "et": 1457971200000,
              "st": 1457884800000,
              "val": 293
            }, {
              "count": 5922689,
              "et": 1458057600000,
              "st": 1457971200000,
              "val": 413
            }, {
              "count": 5480209,
              "et": 1458144000000,
              "st": 1458057600000,
              "val": 1329
            }, {
              "count": 5627674,
              "et": 1458230400000,
              "st": 1458144000000,
              "val": 302
            }, {
              "count": 5228368,
              "et": 1458316800000,
              "st": 1458230400000,
              "val": 346
            }, {
              "count": 4545910,
              "et": 1458403200000,
              "st": 1458316800000,
              "val": 213
            }, {
              "count": 4104255,
              "et": 1458489600000,
              "st": 1458403200000,
              "val": 501
            }, {
              "count": 4837900,
              "et": 1458576000000,
              "st": 1458489600000,
              "val": 311
            }, {
              "count": 2917727,
              "et": 1458640800000,
              "st": 1458576000000,
              "val": 163
            }],
            "id": 684,
            "name": "HTTP错误率"
          }],
          "timeSpan": {
            "endTime": 1458640800000,
            "startTime": 1457341200000
          }
        }
      )
    }

    if (req.query.classify === 'app' && req.query.errorCode !== undefined) {
      res.status(200).json(
        {
          "result": [{
            "combData": {
              "count": 7.4711042E7,
              "et": 1458705600000,
              "st": 1457406000000,
              "val": 1311859
            },
            "data": [{
              "count": 2992947,
              "et": 1457452800000,
              "st": 1457406000000,
              "val": 43278
            }, {
              "count": 4031859,
              "et": 1457539200000,
              "st": 1457452800000,
              "val": 55217
            }, {
              "count": 4170228,
              "et": 1457625600000,
              "st": 1457539200000,
              "val": 61187
            }, {
              "count": 5839928,
              "et": 1457712000000,
              "st": 1457625600000,
              "val": 74814
            }, {
              "count": 5156565,
              "et": 1457798400000,
              "st": 1457712000000,
              "val": 68346
            }, {
              "count": 5087240,
              "et": 1457884800000,
              "st": 1457798400000,
              "val": 62023
            }, {
              "count": 5451586,
              "et": 1457971200000,
              "st": 1457884800000,
              "val": 92329
            }, {
              "count": 5922689,
              "et": 1458057600000,
              "st": 1457971200000,
              "val": 168633
            }, {
              "count": 5480209,
              "et": 1458144000000,
              "st": 1458057600000,
              "val": 144446
            }, {
              "count": 5627674,
              "et": 1458230400000,
              "st": 1458144000000,
              "val": 105378
            }, {
              "count": 5228368,
              "et": 1458316800000,
              "st": 1458230400000,
              "val": 93925
            }, {
              "count": 4545910,
              "et": 1458403200000,
              "st": 1458316800000,
              "val": 81420
            }, {
              "count": 4104255,
              "et": 1458489600000,
              "st": 1458403200000,
              "val": 62867
            }, {
              "count": 4837900,
              "et": 1458576000000,
              "st": 1458489600000,
              "val": 83904
            }, {
              "count": 4827743,
              "et": 1458662400000,
              "st": 1458576000000,
              "val": 90128
            }, {
              "count": 1405941,
              "et": 1458705600000,
              "st": 1458662400000,
              "val": 23964
            }],
            "id": 684,
            "name": "网络错误率"
          }],
          "timeSpan": {
            "endTime": 1458705600000,
            "startTime": 1457406000000
          }
        }
      )
    }
  });

  // 平均执行时间 classify=app
  // https://mi.oneapm.com/mobile/user/4077/app/684/interaction.json?order=202&spanTime=1296000000&size=30&classify=app&offset=0&limit=5&endTime=&_=1457001254732
  app.get('/mobile/user/:userId/app/:appId/interaction.json', function(req, res) {
    res.status(200).json(
      {
        "result": [{
          "combData": {
            "count": 4214308,
            "et": 1458705600000,
            "max": 268.05099,
            "min": 0,
            "st": 1457409600000,
            "total": 1.586707582842E7
          },
          "data": [{
            "count": 165998,
            "et": 1457452800000,
            "max": 252.49899,
            "min": 0,
            "st": 1457409600000,
            "total": 624400.03104
          }, {
            "count": 76830,
            "et": 1457496000000,
            "max": 80.172,
            "min": 0,
            "st": 1457452800000,
            "total": 291745.0301
          }, {
            "count": 171099,
            "et": 1457539200000,
            "max": 109.931,
            "min": 0,
            "st": 1457496000000,
            "total": 630166.61189
          }, {
            "count": 79039,
            "et": 1457582400000,
            "max": 92.315,
            "min": 0,
            "st": 1457539200000,
            "total": 289035.54097
          }, {
            "count": 173683,
            "et": 1457625600000,
            "max": 268.05099,
            "min": 0,
            "st": 1457582400000,
            "total": 644497.70304
          }, {
            "count": 96225,
            "et": 1457668800000,
            "max": 102.821,
            "min": 0,
            "st": 1457625600000,
            "total": 333982.08108
          }, {
            "count": 252052,
            "et": 1457712000000,
            "max": 150.29201,
            "min": 0,
            "st": 1457668800000,
            "total": 862634.42996
          }, {
            "count": 99862,
            "et": 1457755200000,
            "max": 78.896,
            "min": 0,
            "st": 1457712000000,
            "total": 345326.80892
          }, {
            "count": 193587,
            "et": 1457798400000,
            "max": 97.697,
            "min": 0,
            "st": 1457755200000,
            "total": 682597.11098
          }, {
            "count": 95650,
            "et": 1457841600000,
            "max": 84.128,
            "min": 0,
            "st": 1457798400000,
            "total": 311723.33788
          }, {
            "count": 194969,
            "et": 1457884800000,
            "max": 76.938,
            "min": 0,
            "st": 1457841600000,
            "total": 677399.34092
          }, {
            "count": 104072,
            "et": 1457928000000,
            "max": 84.861,
            "min": 0,
            "st": 1457884800000,
            "total": 350502.37695
          }, {
            "count": 206844,
            "et": 1457971200000,
            "max": 82.421,
            "min": 0,
            "st": 1457928000000,
            "total": 756874.33402
          }, {
            "count": 103631,
            "et": 1458014400000,
            "max": 118.224,
            "min": 0,
            "st": 1457971200000,
            "total": 386132.91897
          }, {
            "count": 230666,
            "et": 1458057600000,
            "max": 89.366,
            "min": 0,
            "st": 1458014400000,
            "total": 977111.30411
          }, {
            "count": 103351,
            "et": 1458100800000,
            "max": 83.465,
            "min": 0,
            "st": 1458057600000,
            "total": 383308.87002
          }, {
            "count": 203822,
            "et": 1458144000000,
            "max": 105.292,
            "min": 0,
            "st": 1458100800000,
            "total": 847770.72116
          }, {
            "count": 99644,
            "et": 1458187200000,
            "max": 180.327,
            "min": 0,
            "st": 1458144000000,
            "total": 368833.18917
          }, {
            "count": 206868,
            "et": 1458230400000,
            "max": 114.03,
            "min": 0,
            "st": 1458187200000,
            "total": 803623.15119
          }, {
            "count": 91295,
            "et": 1458273600000,
            "max": 94.119,
            "min": 0,
            "st": 1458230400000,
            "total": 343025.58706
          }, {
            "count": 188672,
            "et": 1458316800000,
            "max": 83.275,
            "min": 0,
            "st": 1458273600000,
            "total": 736824.35391
          }, {
            "count": 86094,
            "et": 1458360000000,
            "max": 83.664,
            "min": 0,
            "st": 1458316800000,
            "total": 322892.254
          }, {
            "count": 158271,
            "et": 1458403200000,
            "max": 101.313,
            "min": 0,
            "st": 1458360000000,
            "total": 627339.52702
          }, {
            "count": 73474,
            "et": 1458446400000,
            "max": 139.321,
            "min": 0,
            "st": 1458403200000,
            "total": 258590.27892
          }, {
            "count": 145547,
            "et": 1458489600000,
            "max": 146.502,
            "min": 0,
            "st": 1458446400000,
            "total": 552491.81195
          }, {
            "count": 81853,
            "et": 1458532800000,
            "max": 145.186,
            "min": 0,
            "st": 1458489600000,
            "total": 311893.77297
          }, {
            "count": 178411,
            "et": 1458576000000,
            "max": 152.909,
            "min": 0,
            "st": 1458532800000,
            "total": 707790.93713
          }, {
            "count": 82721,
            "et": 1458619200000,
            "max": 112.281,
            "min": 0,
            "st": 1458576000000,
            "total": 312374.65599
          }, {
            "count": 183817,
            "et": 1458662400000,
            "max": 83.275,
            "min": 0,
            "st": 1458619200000,
            "total": 804674.57498
          }, {
            "count": 86261,
            "et": 1458705600000,
            "max": 94.399,
            "min": 0,
            "st": 1458662400000,
            "total": 321513.18212
          }],
          "key": {
            "id": 684,
            "name": "平均执行时间"
          }
        }],
        "timeSpan": {
          "endTime": 1458705600000,
          "interval": 43200000,
          "startTime": 1457409600000
        }
      }
    )
  });

  // 平均响应时间 classify=app classifyKeyField=time classifyCountField=num
  // https://mi.oneapm.com/mobile/user/4077/app/684/httptransaction.json?order=2&spanTime=1296000000&size=30&classify=app&offset=0&limit=5&classifyKeyField=time&classifyCountField=num&endTime=&_=1459506660622
  app.get('/mobile/user/:userId/app/:appId/httptransaction.json', function(req, res) {
    res.status(200).json(
      {
        "result": [{
          "combData": {
            "count": 83786171,
            "et": 1459508400000,
            "st": 1458212400000,
            "val": 31645709.17452
          },
          "data": [{
            "count": 1939237,
            "et": 1458255600000,
            "st": 1458212400000,
            "val": 777714.65306
          }, {
            "count": 3442394,
            "et": 1458298800000,
            "st": 1458255600000,
            "val": 1837468.05429
          }, {
            "count": 1807437,
            "et": 1458342000000,
            "st": 1458298800000,
            "val": 816957.57713
          }, {
            "count": 2919029,
            "et": 1458385200000,
            "st": 1458342000000,
            "val": 1657786.92744
          }, {
            "count": 1554901,
            "et": 1458428400000,
            "st": 1458385200000,
            "val": 676794.33593
          }, {
            "count": 2653111,
            "et": 1458471600000,
            "st": 1458428400000,
            "val": 1213246.72278
          }, {
            "count": 1448814,
            "et": 1458514800000,
            "st": 1458471600000,
            "val": 512624.39317
          }, {
            "count": 3229505,
            "et": 1458558000000,
            "st": 1458514800000,
            "val": 1537262.27272
          }, {
            "count": 1613463,
            "et": 1458601200000,
            "st": 1458558000000,
            "val": 674824.4575
          }, {
            "count": 3143950,
            "et": 1458644400000,
            "st": 1458601200000,
            "val": 1340663.99334
          }, {
            "count": 1716154,
            "et": 1458687600000,
            "st": 1458644400000,
            "val": 722047.68014
          }, {
            "count": 3448465,
            "et": 1458730800000,
            "st": 1458687600000,
            "val": 1539570.0914
          }, {
            "count": 2355849,
            "et": 1458774000000,
            "st": 1458730800000,
            "val": 1289570.8556
          }, {
            "count": 4509561,
            "et": 1458817200000,
            "st": 1458774000000,
            "val": 1879378.26846
          }, {
            "count": 2235060,
            "et": 1458860400000,
            "st": 1458817200000,
            "val": 1025532.47438
          }, {
            "count": 4216100,
            "et": 1458903600000,
            "st": 1458860400000,
            "val": 1507584.77009
          }, {
            "count": 2130367,
            "et": 1458946800000,
            "st": 1458903600000,
            "val": 786890.32616
          }, {
            "count": 3551339,
            "et": 1458990000000,
            "st": 1458946800000,
            "val": 1222733.60757
          }, {
            "count": 1810551,
            "et": 1459033200000,
            "st": 1458990000000,
            "val": 561348.24116
          }, {
            "count": 3216569,
            "et": 1459076400000,
            "st": 1459033200000,
            "val": 1180544.10546
          }, {
            "count": 1801724,
            "et": 1459119600000,
            "st": 1459076400000,
            "val": 627192.28716
          }, {
            "count": 3991864,
            "et": 1459162800000,
            "st": 1459119600000,
            "val": 1387514.51622
          }, {
            "count": 2038283,
            "et": 1459206000000,
            "st": 1459162800000,
            "val": 705337.5321
          }, {
            "count": 4214191,
            "et": 1459249200000,
            "st": 1459206000000,
            "val": 1070814.77515
          }, {
            "count": 2094675,
            "et": 1459292400000,
            "st": 1459249200000,
            "val": 603671.00816
          }, {
            "count": 4146565,
            "et": 1459335600000,
            "st": 1459292400000,
            "val": 955074.16022
          }, {
            "count": 2122558,
            "et": 1459378800000,
            "st": 1459335600000,
            "val": 612442.38318
          }, {
            "count": 4190470,
            "et": 1459422000000,
            "st": 1459378800000,
            "val": 1054729.57855
          }, {
            "count": 2168030,
            "et": 1459465200000,
            "st": 1459422000000,
            "val": 854005.2422
          }, {
            "count": 4075955,
            "et": 1459508400000,
            "st": 1459465200000,
            "val": 1014383.8838
          }],
          "id": 684,
          "name": "平均响应时间"
        }],
        "timeSpan": {
          "endTime": 1459508400000,
          "interval": 43200000,
          "startTime": 1458212400000
        }
      }
    )
  });

  // Android崩溃率
  // /mobile/user/{userId}/app/{appId}/androidCrashRate.json?order=301&spanTime=1296000000&size=30&classify=app&offset=0&limit=5&endTime=&_=1457665008084
  app.get('/mobile/user/:userId/app/:appId/androidCrashRate.json', function(req, res) {
    res.status(200).json(
      {
        "result": [
            {
              "combData": {
                "affected": 1,
                "count": 1,
                "et": 1458712800000,
                "firstTime": 1458651521000,
                "lastTime": 1458651521000,
                "st": 1458622800000,
                "appUseCount": 3,
                "crashRate": 0.33
              },
              "data": [{
                "affected": 0,
                "count": 0,
                "et": 1458626400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458622800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458630000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458626400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458633600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458630000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458637200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458633600000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458640800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458637200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458644400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458640800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458648000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458644400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 1,
                "count": 1,
                "et": 1458651600000,
                "firstTime": 1458651521000,
                "lastTime": 1458651521000,
                "st": 1458648000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458655200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458651600000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458658800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458655200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458662400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458658800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458666000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458662400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458669600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458666000000,
                "appUseCount": 3,
                "crashRate": 0.43
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458673200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458669600000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458676800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458673200000,
                "appUseCount": 3,
                "crashRate": 0.13
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458680400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458676800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458684000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458680400000,
                "appUseCount": 3,
                "crashRate": 0.73
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458687600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458684000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458691200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458687600000,
                "appUseCount": 3,
                "crashRate": 0.53
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458694800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458691200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458698400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458694800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458702000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458698400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458705600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458702000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458709200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458705600000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458712800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458709200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }],
              "key": {
                "appVersionId": 0,
                "fixed": false,
                "fixedTimestamp": 0,
                "follow": false,
                "id": 1433,
                "ignores": false,
                "name": "4.1.5"
              }
            },
            {
              "combData": {
                "affected": 3,
                "count": 4,
                "et": 1458712800000,
                "firstTime": 1458628250000,
                "lastTime": 1458695475000,
                "st": 1458622800000,
                "appUseCount": 3,
                "crashRate": 0.43
              },
              "data": [{
                "affected": 0,
                "count": 0,
                "et": 1458626400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458622800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 1,
                "count": 1,
                "et": 1458630000000,
                "firstTime": 1458628250000,
                "lastTime": 1458628250000,
                "st": 1458626400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458633600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458630000000,
                "appUseCount": 3,
                "crashRate": 0.73
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458637200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458633600000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 1,
                "count": 1,
                "et": 1458640800000,
                "firstTime": 1458637844000,
                "lastTime": 1458637844000,
                "st": 1458637200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458644400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458640800000,
                "appUseCount": 3,
                "crashRate": 0.43
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458648000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458644400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458651600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458648000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458655200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458651600000,
                "appUseCount": 3,
                "crashRate": 0.13
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458658800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458655200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458662400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458658800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458666000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458662400000,
                "appUseCount": 3,
                "crashRate": 0.73
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458669600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458666000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458673200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458669600000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458676800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458673200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458680400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458676800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458684000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458680400000,
                "appUseCount": 3,
                "crashRate": 0.23
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458687600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458684000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458691200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458687600000,
                "appUseCount": 3,
                "crashRate": 0.43
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458694800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458691200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 1,
                "count": 2,
                "et": 1458698400000,
                "firstTime": 1458695475000,
                "lastTime": 1458695475000,
                "st": 1458694800000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458702000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458698400000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458705600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458702000000,
                "appUseCount": 3,
                "crashRate": 0.33
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458709200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458705600000,
                "appUseCount": 3,
                "crashRate": 0.53
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458712800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458709200000,
                "appUseCount": 3,
                "crashRate": 0.33
              }],
              "key": {
                "appVersionId": 0,
                "fixed": false,
                "fixedTimestamp": 0,
                "follow": false,
                "id": 1165,
                "ignores": false,
                "name": "4.1.2"
              }
            }
          ],
        "timeSpan": {
            "endTime": 1458712800000,
            "startTime": 1458622800000
        }
      }
    );
  });

  // ios崩溃率
  // /mobile/user/{userId}/app/{appId}/iosCrashRate.json?order=301&spanTime=1296000000&size=30&classify=app&offset=0&limit=5&endTime=&_=1457668073377
  app.get('/mobile/user/:userId/app/:appId/iosCrashRate.json', function(req, res) {
    res.status(200).json(
      {
        "result": [
            {
              "combData": {
                "affected": 1,
                "count": 1,
                "et": 1458712800000,
                "firstTime": 1458651521000,
                "lastTime": 1458651521000,
                "st": 1458622800000,
                "appUseCount": 4,
                "crashRate": 0.25
              },
              "data": [{
                "affected": 0,
                "count": 0,
                "et": 1458626400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458622800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458630000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458626400000,
                "appUseCount": 4,
                "crashRate": 0.35
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458633600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458630000000,
                "appUseCount": 4,
                "crashRate": 0.55
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458637200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458633600000,
                "appUseCount": 4,
                "crashRate": 0.15
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458640800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458637200000,
                "appUseCount": 4,
                "crashRate": 0.55
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458644400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458640800000,
                "appUseCount": 4,
                "crashRate": 0.45
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458648000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458644400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 1,
                "count": 1,
                "et": 1458651600000,
                "firstTime": 1458651521000,
                "lastTime": 1458651521000,
                "st": 1458648000000,
                "appUseCount": 4,
                "crashRate": 0.35
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458655200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458651600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458658800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458655200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458662400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458658800000,
                "appUseCount": 4,
                "crashRate": 0.65
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458666000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458662400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458669600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458666000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458673200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458669600000,
                "appUseCount": 4,
                "crashRate": 0.45
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458676800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458673200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458680400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458676800000,
                "appUseCount": 4,
                "crashRate": 0.85
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458684000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458680400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458687600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458684000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458691200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458687600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458694800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458691200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458698400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458694800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458702000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458698400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458705600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458702000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458709200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458705600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458712800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458709200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }],
              "key": {
                "appVersionId": 0,
                "fixed": false,
                "fixedTimestamp": 0,
                "follow": false,
                "id": 1433,
                "ignores": false,
                "name": "4.1.5"
              }
            },
            {
              "combData": {
                "affected": 3,
                "count": 4,
                "et": 1458712800000,
                "firstTime": 1458628250000,
                "lastTime": 1458695475000,
                "st": 1458622800000,
                "appUseCount": 4,
                "crashRate": 0.25
              },
              "data": [{
                "affected": 0,
                "count": 0,
                "et": 1458626400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458622800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 1,
                "count": 1,
                "et": 1458630000000,
                "firstTime": 1458628250000,
                "lastTime": 1458628250000,
                "st": 1458626400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458633600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458630000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458637200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458633600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 1,
                "count": 1,
                "et": 1458640800000,
                "firstTime": 1458637844000,
                "lastTime": 1458637844000,
                "st": 1458637200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458644400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458640800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458648000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458644400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458651600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458648000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458655200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458651600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458658800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458655200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458662400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458658800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458666000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458662400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458669600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458666000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458673200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458669600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458676800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458673200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458680400000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458676800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458684000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458680400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458687600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458684000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458691200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458687600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458694800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458691200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 1,
                "count": 2,
                "et": 1458698400000,
                "firstTime": 1458695475000,
                "lastTime": 1458695475000,
                "st": 1458694800000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458702000000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458698400000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458705600000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458702000000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458709200000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458705600000,
                "appUseCount": 4,
                "crashRate": 0.25
              }, {
                "affected": 0,
                "count": 0,
                "et": 1458712800000,
                "firstTime": 0,
                "lastTime": 0,
                "st": 1458709200000,
                "appUseCount": 4,
                "crashRate": 0.25
              }],
              "key": {
                "appVersionId": 0,
                "fixed": false,
                "fixedTimestamp": 0,
                "follow": false,
                "id": 1165,
                "ignores": false,
                "name": "4.1.2"
              }
            }
          ],
        "timeSpan": {
            "endTime": 1458712800000,
            "startTime": 1458622800000
        }
      }
    );
  });

  // 创建查询
  app.get('/mobile/user/:userId/app/:appId/queryAlarmStrategy.json', function (req, res) {
    res.json(
      {
        "appId": 111,
        "alarmName": "崩溃报警项1",
        "alarmType": 1,//警报项目 1、APP整体
        "cpm":10,//全局吞吐量
        "alarmStatus": 1, //警报状态 1、ALERT 2、WARN 3、OK 4、NO DATA
        "isMuted":0,//是否禁用，1 禁用，0启用
        "createUserId": 123,
        "createUserName":"aaa",
        "createTime":11111111,    //创建时间
        "lastModifyUser":"bbb",  //最后操作人
        "lastModifyTime":222222, //最后操作日期
        "rule": [
          {
            "ruleType": 1,//警报类型 1、响应时间，2、崩溃率 3、HTTP错误率 4、网络错误率
            "cpm": 100, //吞吐量
            "groupBy": 1,//分组方式 1、总体 2、区域 3、区域和运营商
            "criteria": [
              {
                "severity": 2, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 5 //阈值 单位：毫秒 或 百分百
              },
              {
                "severity": 1, //策略定义级别 1、告警 WARN 2、报警 ALERT
                "criteriaType": 1,//类型 1、数值 2、频率 3、无事件
                "duration": 5,//持续时间 单位：分钟
                "operation": "gt",//运算符 gt >
                "threshold": 10 //阈值 单位：毫秒 或 百分百
              }
            ]
          },
          {
            "ruleType": 2,
            "cpm": 100,
            "groupBy": 1,
            "criteria": [
              {
                "severity": 2,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 6
              },
              {
                "severity": 1,
                "criteriaType": 2,
                "duration": 5,
                "operation": "gt",
                "threshold": 10
              }
            ]
          }
        ]
      }
    );
  });

  // 创建告警
  app.post('/mobile/user/:userId/app/:appId/createAlarmStrategy.json', function (req, res) {
    res.json({
      status: 0,
      message: 'success'
    });
  });

  // 删除告警
  app.delete('/mobile/user/:userId/app/:appId/deleteAlarmStrategy.json', function (req, res) {
    res.json({
      status: 0,
      message: 'success'
    });
  });

  // 禁用告警
  app.put('/mobile/user/:userId/app/:appId/updateAlarmMuted.json', function (req, res) {
    res.json({
      status: 0,
      message: 'success'
    });
  });

  // 修改告警
  app.put('/mobile/user/:userId/app/:appId/updateAlarmStrategy.json', function (req, res) {
    res.json({
      status: 0,
      message: 'success'
    });
  });
};
